package com.oocl.chatroom.server;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Date;

import com.oocl.chatroom.network.protocol.Message;


public class Client {
    public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException {
		Socket socket  = new Socket("127.0.0.1",8888);
		OutputStream out = socket.getOutputStream();
		ObjectOutputStream oout = new ObjectOutputStream(out);
		Message msg = new Message("",2,"Client","",(new Date()).getTime());
		oout.writeObject(msg);
		Thread.sleep(20000);
			Message msg1 = new Message("你好啊",0,"Client","Client1",(new Date()).getTime());
			oout.writeObject(msg1);
			Message msg2 = new Message("你好啊",0,"Client","*",(new Date()).getTime());
			
			Thread.sleep(10000);
			oout.writeObject(msg2);
			
			//Message msg3 = new Message("Client","","good byte",3,(new Date()).getTime());
			Thread.sleep(10000);
//			oout.writeObject(msg3);
//			System.out.println("再一次發送msg1");
//			oout.writeObject(msg1);
//			System.out.println("發送完畢");
			
	while(true){
		Thread.sleep(20000);
		}
			
	}
}
